<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>让页面后退和前进</title>
    <script type="text/javascript">
        //前进
        function goForward() {
            window.history.forward(); //到之前网页

        }
        //后退
        function goBack() {
            window.history.back()   //到网页之后

        }

    </script>
</head>
<body style="text-align: center">
<p>
    <!--定义前进和后退的按钮-->
    <input type="button" value="前进" onclick="goForward()"/>
    <input type="button" value="后退" onclick="goBack()"/>
</p>


</body>
</html>